#ifndef __PG_DBCONNECTION_PFARM_H_
#define __PG_DBCONNECTION_PFARM_H_

#include "Farm.h"

class PFarm : public Farm
{
	public:   
		PFarm(DbParam dbParameters, const char *readers, const char *writers, bool debug = false); 
		PGconn *GetReader();
		PGconn *GetWriter(int idx);
		void CloseConnection(PGconn *c, bool write = false) ; 
		int GetWriterSize() { return writers_.size(); }
                void Print();
		~PFarm() { closeAll(); }
	protected:
		bool initilize(const char *readers,const char *writers);
		void closeAll();
		PGconn *getNextReader(int &num, int size);
		vector < PDbHost * > readers_;
		vector < PDbHost * > writers_;

};

#endif
